import {SlateElement} from '@wangeditor/editor'
import {GapElement} from './renderElem.ts'

function gapElToHtml(elem: SlateElement): string {
	const {gapNum = 1} = elem as GapElement
	// 通过data-w-e开头的data数据，存放一些必要的信息，到时候通过setHtml将富文本信息还原回编辑器的时候，才能使编辑器正常识别
	return `<span data-w-e-type="gapFilling" data-gap-num="${gapNum}" class="gapFilling">${gapNum}</span>`
}

export const gapToHtmlConf = {
	type: 'gapFilling',
	elemToHtml: gapElToHtml
}
